﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;

namespace OpenSearch.Client
{
    public class SearchProviderInfo
    {
        public SearchProviderInfo(string name, Uri searchUrl, Uri suggestionsUrl, bool showSuggestions, Uri favIcon)
        {
            Contract.Requires(name != null);
            Contract.Requires(searchUrl != null && searchUrl.Query.Contains(OpenSearchUriBuilder.SearchTerms));
            Contract.Requires(!showSuggestions || (suggestionsUrl != null && suggestionsUrl.Query.Contains(OpenSearchUriBuilder.SearchTerms))); // Only check suggestions if show is true
            Contract.Requires(favIcon != null);

            SearchUrl = searchUrl;
            SuggestionsUrl = suggestionsUrl;
            ShowSearchSuggestions = showSuggestions;
            FavIconUri = favIcon;
            Name = name;
        }

        public Uri SearchUrl { get; private set; }
        public Uri SuggestionsUrl { get; private set; }
        public bool ShowSearchSuggestions { get; private set; }
        public Uri FavIconUri { get; private set; }
        public string Name { get; private set; }

    }
}
